<template lang="">
    <div class="B">
        <h1>我是B组件</h1>
        {{ data }}
        <div> <button @click="changeFlag">change Flag </button></div>  
        <!-- <div> <button @click="data=!data">change Flag </button></div>   -->
    </div>
</template>
<script lang="ts" setup>
import { inject, Ref ,ref} from 'vue';
let data = inject<Ref<boolean>>('flag',ref(false))
const changeFlag = ()=>{
    data.value = true
}


</script>

<style lang="less">
.B {
    width: 200px;
    height: 200px;
    background: green;
    color: #fff;
}
</style>